<template>
  <div>
    <p>
      <router-link to="/newslist">新闻列表</router-link>&nbsp;&nbsp;
      <router-link to="/foodlist">食品列表</router-link>
    </p>
    <!-- 一级路由出口 -->
    <!-- Vue2设置keep-alive -->
    <!-- <keep-alive>
      <router-view />
    </keep-alive> -->

    <!-- Vue3设置keep-alive -->
    <router-view v-slot="{ Component }">
      <keep-alive>
        <component :is="Component" />
      </keep-alive>
    </router-view>
  </div>
</template>
